package edu.pku.util;

import java.io.IOException;
import java.io.Reader;

import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

public class MySqlMapClient {

   private static SqlMapClient sqlMapClient;

   static {
    String resource = "edu/pku/data/xml/SqlMapConfigExample.xml";
    Reader reader = null;
    try {
     reader = Resources.getResourceAsReader(resource);
     sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader);
    } catch (IOException e) {
     e.printStackTrace();
    }
   }

   public static SqlMapClient getSqlMapInstance() {
    return sqlMapClient;
   }

}
